home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Video Toaster 4.3
/
Video Toaster v4.3.iso
/
3.1
/
toasterall
/
arexx_examples
/
tpaint
/
shrinkpic.rexx
< prev
next >
Wrap
OS/2 REXX Batch file
|
1992-01-29
|
4KB
|
105 lines
/* ShrinkPic.rexx Shrink screen in ToasterPaint */
/* By Arnie Cachelin © 1992 NewTek Inc. */
/* Warning, stomps ruthlessly on your swap screen and swap brush! */
/*
This program will shrink a given picture by a given amount. If no
directory and picture name is given, it will shrink the current canvas to
1/4 it's size.
*/
ARG Name factor /* Optional picture to load, and reduction amount */
if pos('DigiPaint',show(ports))=0 then do
say "Can't find ToasterPaint!"
exit
end
Address "DigiPaint" /* Tell ARexx where commands go */
if factor="" then Rfactor=4 /* reduction factor, size =1/rfactor, set this to 2,3,4... */
else Rfactor=factor
if name~="" then LoadRGB(name) /* if no name is given, we will shrink the current screen! */
w=752
h=480
w2=(w%RFactor) /* % means integer division... */
h2=(h%RFactor)
'Pmcl' /* Normal paint mode */
'Swap' /* jump to swap screen! */
'Cbx0' /* Pick color zero to clear */
'Clrs' /* Clear screen */
'Swap' /* jump to picture screen! */
MapScreen(0,0,w2,h2) /* Place resized screen on swap screen */
CutBrush(0,0,w2,h2) /* Cut resized brush */
SaveBrush("ram:","tst")
'Bcop' /* Copy brush to swap brush */
'Swap' /* jump back to original screen */
'Pmcl' /* Normal paint mode, TxMap off */
exit
CutBrush: Procedure /* Cut out a brush with corners at (x1,y1) and (x2,y2) */
arg x1, y1, x2, y2
'Dotb' /* smallest brush size */
'Drre' /* Rectangle mode */
'Scis' /* Scissors on, for cutting a brush */
'Pend' x1 y1 /* Get in top Left corner */
'Penu' x2 y2 /* lift pen to get brush! */
return
MapScreen: Procedure /* Size full screen into rectangle with corners at (x1,y1) and (x2,y2) */
arg x1, y1, x2, y2 /* rectangle is drawn on swap screen */
'Pmcl' /* Normal draw Mode */
'Maxc' /* Set center transparency off */
'Maxe' /* Set edge transparency off */
'Flon' /* Fill On */
'Bdel' /* Delete swap brush */
'Dotb' /* Delete any current cut-out brush */
'Drre' /* Draw Rectangles */
'Swap' /* Jump to (blank) swap screen! */
'Pend' x1 y1 /* Get in top Left corner */
'Penu' x2 y2 /* Lift pen at bottom right */
'Undo' /* Un-draw solid rectangle */
'Rubi' /* Internal Rub-Thru on... use picture in swap screen as source */
'Aaon' /* Anti-alias on */
'Txma' /* Texture mapping on, since there is no brush, it will use whole screen */
'Redo' /* Re-draw rectangle, this time with texture map of swap screen */
'Flof' /* Fill off */
'Pmcl' /* Normal draw Mode */
return
LoadRGB: Procedure /* Load Picture */
arg filename
'Lo24' /* Call file requester */
Call SetFile(filename)
return
SaveBrush: PROCEDURE /* Save Brush */
arg filename
'Sabr' /* Call file requester */
Call SetFile(filename)
return
SetFile: PROCEDURE /* Select file in current requester */
arg file
dirname=GetPathName(file)
'Dnam'dirname /* Enter file path */
'Dsel' /* Hit return on directory */
filename=GetFileName(file)
'Fnam'filename /* Enter File name */
'Okls' /* Hit the OK button */
return
GetFileName: procedure /* Extract file name from full file specification */
ARG fullfile
c = lastpos("/",fullfile)
if c = 0 then c = lastpos(":",fullfile)
return substr(fullfile, c + 1)
GetPathName: procedure /* Extract directory name from full file specification */
ARG fullfile
c = lastpos("/",fullfile)
if c = 0 then c = lastpos(":",fullfile)
return left(fullfile,c)